Attaching package: 'scales'
The following object is masked from 'package:purrr':
discard
The following object is masked from 'package:readr':
col_factor
Attaching package: 'reshape2'
The following object is masked from 'package:tidyr':
smiths
jobs_df <-read_csv('../../data/job_data.csv')
New names:
Rows: 823 Columns: 17
── Column specification
──────────────────────────────────────────────────────── Delimiter: "," chr
(13): title, company_name, location, via, description, schedule_type, qu... dbl
(3): ...1, salary, experience lgl (1): remote
ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
Specify the column types or set `show_col_types = FALSE` to quiet this message.
• `` -> `...1`
# create a new column 'experience_group' based on 'experience'jobs_df$experience_group <-cut(jobs_df$experience, c(0, 5, 10, Inf),labels =c('0-5', '5-10', '10+'))
# create the plotly plotap <- jobs_df_pivot %>%plot_ly(hovertext ="Degree, Salary") ap <- ap %>%add_trace(x = jobs_df_pivot$degree, y =~`0-5`, type ='bar', name ='0-5', marker =list(color ='#118C4F'))ap <- ap %>%add_trace(x = jobs_df_pivot$degree, y =~`5-10`, type ='bar', name ='5-10', marker =list(color ='#FFB90D'))ap <- ap %>%add_trace(x = jobs_df_pivot$degree, y =~`10+`, type ='bar', name ='10+' , marker =list(color ='red'))# set the plot layout and themeap <- ap %>%layout(title =list(text ="", y =0.98, font =list(family ="Arial", size =18, color ="white")),xaxis =list(title =list(text ="Degree", font =list(family ="Arial", color ="white")), tickfont =list(color ="white")),yaxis =list(title =list(text ="Salary (USD)", font =list(family ="Arial", color ="white")),tickprefix ="$", tickformat =",",tickfont =list(color ="white")),legend =list(title =list(text ="Years of Experience", font =list(color ="white")), font =list(color ="white")),template ="plotly_dark",paper_bgcolor ="black",plot_bgcolor ="black" )ap